package com.bauer.java.spring.postprocessor;

import com.bauer.java.spring.bean.User;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;

/**
 * @program: java
 * @description:
 * @author: bauer weo
 * @create: 2019-10-28 18:01
 */
@Component
public class BeanPostProcessorDemo implements BeanPostProcessor {

    @Override
    public Object postProcessBeforeInitialization(Object o, String s) throws BeansException {
        if (o instanceof User) {
            System.out.println("postProcessBeforeInitialization");
        }

        return o;
    }

    @Override
    public Object postProcessAfterInitialization(Object o, String s) throws BeansException {
        if (o instanceof User) {
            System.out.println("postProcessAfterInitialization");
        }

        return o;
    }

}
